1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module sourceview.CompletionWords;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import gtk.TextBuffer;
31 private import sourceview.CompletionProviderIF;
32 private import sourceview.CompletionProviderT;
33 private import sourceview.c.functions;
34 public  import sourceview.c.types;
35 
36 
37 /**
38  * A [iface@CompletionProvider] for the completion of words.
39  * 
40  * The `GtkSourceCompletionWords` is an example of an implementation of
41  * the [iface@CompletionProvider] interface. The proposals are words
42  * appearing in the registered [class@Gtk.TextBuffer]s.
43  */
44 public class CompletionWords : ObjectG, CompletionProviderIF
45 {
46 	/** the main Gtk struct */
47 	protected GtkSourceCompletionWords* gtkSourceCompletionWords;
48 
49 	/** Get the main Gtk struct */
50 	public GtkSourceCompletionWords* getCompletionWordsStruct(bool transferOwnership = false)
51 	{
52 		if (transferOwnership)
53 			ownedRef = false;
54 		return gtkSourceCompletionWords;
55 	}
56 
57 	/** the main Gtk struct as a void* */
58 	protected override void* getStruct()
59 	{
60 		return cast(void*)gtkSourceCompletionWords;
61 	}
62 
63 	/**
64 	 * Sets our main struct and passes it to the parent class.
65 	 */
66 	public this (GtkSourceCompletionWords* gtkSourceCompletionWords, bool ownedRef = false)
67 	{
68 		this.gtkSourceCompletionWords = gtkSourceCompletionWords;
69 		super(cast(GObject*)gtkSourceCompletionWords, ownedRef);
70 	}
71 
72 	// add the CompletionProvider capabilities
73 	mixin CompletionProviderT!(GtkSourceCompletionWords);
74 
75 
76 	/** */
77 	public static GType getType()
78 	{
79 		return gtk_source_completion_words_get_type();
80 	}
81 
82 	/**
83 	 *
84 	 * Params:
85 	 *     title = The title for the provider, or %NULL.
86 	 * Returns: a new #GtkSourceCompletionWords provider
87 	 *
88 	 * Throws: ConstructionException GTK+ fails to create the object.
89 	 */
90 	public this(string title)
91 	{
92 		auto __p = gtk_source_completion_words_new(Str.toStringz(title));
93 
94 		if(__p is null)
95 		{
96 			throw new ConstructionException("null returned by new");
97 		}
98 
99 		this(cast(GtkSourceCompletionWords*) __p, true);
100 	}
101 
102 	/**
103 	 * Registers @buffer in the @words provider.
104 	 *
105 	 * Params:
106 	 *     buffer = a #GtkTextBuffer
107 	 */
108 	public void register(TextBuffer buffer)
109 	{
110 		gtk_source_completion_words_register(gtkSourceCompletionWords, (buffer is null) ? null : buffer.getTextBufferStruct());
111 	}
112 
113 	/**
114 	 * Unregisters @buffer from the @words provider.
115 	 *
116 	 * Params:
117 	 *     buffer = a #GtkTextBuffer
118 	 */
119 	public void unregister(TextBuffer buffer)
120 	{
121 		gtk_source_completion_words_unregister(gtkSourceCompletionWords, (buffer is null) ? null : buffer.getTextBufferStruct());
122 	}
123 }